package com.px.chapter_Nov_1;

import java.util.Scanner;

public class text6_1 {
    public static void main(String[] args) {
        int y,m,d,mm=0,ii=0;
        String th="五";
        Scanner scanner=new Scanner(System.in);
        y=scanner.nextInt();
        m=scanner.nextInt();
        d=scanner.nextInt();
        int days=(y-1900)*365;

        for (int i=1900;i<y;i++){
            if (i%4==0&&i%100!=0||i%400==0){
                days++;
            }
        }
        int dd=1;
        for (int oo=m;oo>1;oo--){

        switch (dd){

            case 4:case 6:case 9:case 11:
                mm=30;
                break;
            case 2:
                if (y%4==0&&y%100!=0){
                    mm=29;
                }else {
                    mm=28;
                }

            default:
                mm=31;
                break;

        }
        ii=mm+ii;
        System.out.println(mm);

        dd++;
        if (dd==m){
            break;
        }
        }
        days=ii+days;
        switch ((days+d)%7){
            case 1:
                th="星期1";
                break;
            case 2:
                th="星期2";
                break;
            case 3:
                th="星期3";
                break;
            case 4:
                th="星期4";
                break;
            case 5:
                th="星期5";
                break;
            case 6:
                th="星期6";
                break;
            case 0:
                th="星期7";
                break;

        }
        System.out.println(th+"  "+(days+d)%7);


    }
}
